<?php
		/*include_once('init.php');*/


		

        

        $id=!empty($_GET['id'])?$_GET['id']:'';

		

		if(!empty($_POST)) {


		/*	$stuas=$_POST['stuas'];
			echo $stuas;die;*/

			if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_POST['filed'])) {

        	$id=$_POST['id'];
        	$where['val']=$_POST['val'];
        	$where['filed']=$_POST['filed'];


        	$row=edit('admin',$where);
        	
        	echo $row;die;
        			
        };

/*
			if(!empty($_SERVER['HTTP_X_REQUESTED_WITH'])) {

        	$id=$_POST['id'];
        	
        	$stuas=$_POST['stuas'];


        	$sql="update `news` set `status`='$stuas' where `id`='$id'";
        	
        	mysqli_query($link,$sql);
        	$row = mysqli_affected_rows($link);
        	
        	echo $row;die;*/

       /* print_r($row);die;*/
        			
       /* };*/
		
			

		$where['username']=$_POST['username'];
		$where['password']=$_POST['password'];

		
/*		
		$link = mysqli_connect('localhost','root','root','p301');
	
		if (!$link) {
			
			echo '<script>alert("数据库连接错误");history.go(-1);</script>';die;
		}
	
		mysqli_query($link,'set names utf8');*/
	

		$row=edit('admin',$where);
        if ($row>0) {
        	echo '<script>alert("添加成功");location.href="index.php?c=name&a=news&admin=1";</script>';

        }else{
        	echo '<script>alert("添加失败");history.go(-1);</script>';die;
        }
    }
		


		$arr=getselectByone('admin',"`id`='$id'");
   
   include( VIEW_PATH.$admin.'layst.html');



?>
